<template>
  <!-- 添加或修改盘点计划对话框 -->
  <el-dialog :title="title" v-if="open" v-model="open" width="550px" append-to-body>

    <el-form ref="form" :model="form" :rules="rules" label-width="130px">

      <el-form-item label="分组名称:" prop="groupName">
        <el-input v-model="form.groupName" style="width: 218px;"></el-input>
      </el-form-item>
      <el-form-item label="排序:" v-if="form.id">
        <el-input type="number" v-model="form.sort" style="width: 218px;"></el-input>
      </el-form-item>
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button @click="cancel">取 消</el-button>
        <el-button type="primary" @click="submitForm">确定</el-button>
      </div>
    </template>
  </el-dialog>
</template>

<script>
import modelMixin from '@/mixins/modelMixin'
import materialPptGroup from '@/api/goods/materialPptGroup/index';
export default {
  name: "addForm",
  mixins: [modelMixin],
  props: {
    classifyList: {
      type: Array,
      default: () => []
    },
  },
  data() {
    return {
      funcObj: materialPptGroup,//方法对象
      open: false,
      title: "新增分组",
      form: {},
      selectedOptions: [],
      contacts: [{}],
      rules: {
        groupName: [
          { required: true, message: "请输入分组名称", trigger: "blur" }
        ]
      },
      // classifyList: [],
    }
  },
  created() {
    // this.getClassifyAllList()
  },
  methods: {
    add() {
      this.open = true;
      this.form = {}
      this.title = "新增分组"
    },

    /**
     * @编辑
     * @param {*} id 
     */
    edit(row) {
      this.open = true;
      this.form = JSON.parse(JSON.stringify(row))
      this.title = "编辑分组"
    },
    classifyForm() {
      this.form.groupStatus = 0
    },
  }
}
</script>

<style lang="scss">
.el-form-item__content {
  width: auto !important;
}
</style>